home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
ifl
/
iflBitArray.z
/
iflBitArray
Wrap
Text File
|
1998-10-20
|
5KB
|
132 lines
iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333)))) IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))
NNNNAAAAMMMMEEEE
iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy - limited subscriptable bit array class
IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
none, standalone object
HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
#include <ifl/iflBitArray.h>
CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
This class implements a very limited functionality subscriptable bit
array that is used by the image data type converter (iflConverter). The
constructor requires a void* initializer, so a form such as
int from[1024], to[1024];
iflBitArray f = from, t = to;
declares bit "pointers" referencing the iiiinnnntttt arrays. The bit array can
then be accessed with contructs of the form
floatVal = (float)f[i];
and deposits made with statements such as
t[i] = floatVal; // no cast needed
CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
iflBitArray(void* dp)
SSSSuuuubbbbssssccccrrrriiiipppptttteeeedddd aaaacccccccceeeessssssss
iflBitArray& operator[](int idx)
void operator=(long rhs)
operator long()
FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy(((())))
iflBitArray(void* dp)
Constructs a bit "pointer" that accesses the bit array pointed to by
_d_p. Use the subscript operator to access elements of the array off
this pseudo-pointer on either the left-hand or right-hand side of an
assignment.
PPPPaaaaggggeeee 1111
iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333)))) IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiiffffllllBBBBiiiittttAAAArrrrrrrraaaayyyy((((3333))))
ooooppppeeeerrrraaaattttoooorrrr[[[[]]]]
iflBitArray& operator[](int idx)
The subscript operator stores the byte and bit offsets needed to
access the element specified by _i_d_x. This function returns a self-
reference so the real work can be done with the cast and assigment
operators for this class. It works with certain restrictions noted
below.
ooooppppeeeerrrraaaattttoooorrrr====
void operator=(long rhs)
The assignment operator clears or sets the bit pointed to by the
left-hand side of the assigment. The bit is set if _r_h_s is nonzero,
otherwise it is cleared. By only allowing a long for the right-hand
side, a bit subscript on the right is automatically extracted by
going through the cast operator. C++ converts other types such as
ffffllllooooaaaatttt and sssshhhhoooorrrrtttt to lllloooonnnngggg without complaining.
ooooppppeeeerrrraaaattttoooorrrr lllloooonnnngggg
operator long()
The cast operator extracts the (previously remembered) subscripted
bit. Again, C++ fills in all the other type conversions.
NNNNOOOOTTTTEEEESSSS
Due to limitations of the implementation, the same bit "pointer" must not
occur twice in the same assignment (with different subscripts):
t[i] = ~(long)t[j]; // bogus result (depends on order of evaluation)
t[i] = f[j]; // ok even if 't' and 'f' point to same data array
PPPPaaaaggggeeee 2222